package com.ymsoft.myerp.common;

/**
 * 返回码枚举类
 */
public enum RetEnum {

    // 公共返回码10开头
    SUCCESS(0, "success"), //用于layui数据表格默认成功状态码0
    BAD_REQUEST(400, "参数或者语法不对"),
    UNAUTHORIZED(401, "认证失败"),
    LOGIN_ERROR(401, "登陆失败，用户名或密码无效"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "请求的资源不存在"),
    OPERATE_ERROR(405, "操作失败，请求操作的资源不存在"),
    TIME_OUT(408, "请求超时"),
    SERVER_ERROR(500, "服务器内部错误"),
    INNER_ERROR(501, "操作失败"),
    RET_COMM_PARAM_ERROR(10001, "参数错误"),
    RET_COMM_PARAM_NOT_FOUND(10002, "缺少参数"),
    RET_COMM_OPERATION_FAIL(10003, "操作失败"),
    RET_COMM_RECORD_NOT_EXIST(10004, "记录不存在"),
    RET_COMM_FILE_UPLOAD_FAILED(10005, "文件上传失败"),
    RET_COMM_UNKNOWN_ERROR(10006, "未知错误"),

    RET_COMM_ADMIN_ROLE_FORBIDDEN_TO_DELETE(11000, "管理员角色禁止删除"),
    RET_USER_NAME_USED(11001, "用户名已经存在"),

    RET_DICT_SAME_CODE_UNDER_SUPPER_PARENT(12000, "顶级字典下存在相同的字典标识"),
    RET_DICT_CHOOSE_SELF(12001, "不能选择自己作为父级")
    ;

    private int code;
    private String message;

    RetEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode()
    {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

}
